package com.wn55.hrms.config;

import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.lang.reflect.Method;


@Configuration
public class MyGenerateKeyConfig {

    @Bean(value = "keyGenerator")
    public KeyGenerator keyGenerator(){
        //匿名内部类
        return new KeyGenerator(){

            @Override
            public Object generate(Object target, Method method, Object... params) {

                return target.getClass()+method.getName()+params.toString();
            }
        };
    }

}
